package com.zusmart.core.config.source;

import java.util.Properties;

import com.zusmart.base.util.Assert;
import com.zusmart.core.config.support.AbstractConfigSource;

public class ConfigSourceForProperties extends AbstractConfigSource {

	public static final String EXTENSION = "properties";

	private final Properties properties;

	public ConfigSourceForProperties(String configFile, Properties properties) {
		super(configFile, EXTENSION);
		Assert.isNull(properties, "properties must not be null");
		this.properties = properties;
	}

	@Override
	public boolean hasConfigData(String configName) {
		return this.properties.containsKey(configName);
	}

	@Override
	public String getConfigData(String configName, String defaultData) {
		return this.properties.getProperty(configName, defaultData);
	}

}